local sound = {}
sound.volume = 0.5
love.audio.setVolume(0.1)
function sound:init()
	self.source = {}
	for _,name in ipairs(love.filesystem.getDirectoryItems("res/sound/")) do
		self.source[name:sub(1,-5)] = love.audio.newSource("res/sound/"..name,"static")
	end
	return self
end

function sound:setVolume(n)
	love.audio.setVolume(n)
end

function sound:play(name)
	local source = self.source[name]
	source:stop()
	source:play()
end

function sound:stop(name)
	self.source[name]:stop()
end

function sound:stopAll()
	for name,source in pairs(self.source) do
		source:stop()
	end
end

return sound